const express = require('express');
const BlogRouter = express.Router();
const BlogController = require('../../controllers/admin/BlogController')
// multer 中间件用于处理 form-data 数据（文件上传）
const multer = require('multer')
const upload = multer({ dest: 'public/coveruploads/' })


BlogRouter.post('/adminapi/blog/add', upload.single('file'), BlogController.add)
BlogRouter.get('/adminapi/blog/list',BlogController.list)
BlogRouter.post('/adminapi/blog/list', upload.single('file'), BlogController.update)
BlogRouter.get('/adminapi/blog/list/:id', BlogController.list)
BlogRouter.put('/adminapi/blog/publish', BlogController.publish)
BlogRouter.delete('/adminapi/blog/:id',BlogController.delete)

module.exports = BlogRouter;